home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 2
/
Nebula Two.iso
/
SourceCode
/
MiscKit1.7.1
/
MiscKit
/
Examples
/
IconTester
/
IconController.m
< prev
next >
Wrap
Text File
|
1996-02-08
|
2KB
|
104 lines
#import "IconController.h"
@implementation IconController
//** designated initializer
- init
{
List *temp;
if (self = [super init]) {
animator = [[MiscAppIconAnimator alloc] init];
//** create array of images
temp = [[List alloc] init];
[temp addObject:[NXImage findImageNamed:"Bronto"]];
[temp addObject:[NXImage findImageNamed:"Raptor"]];
[temp addObject:[NXImage findImageNamed:"TriTop"]];
[animator setImageArray:temp];
//** create array of pattern order
temp = [[List alloc] init];
[temp addObject:(id)0];
[temp addObject:(id)1];
[temp addObject:(id)2];
[temp addObject:(id)1];
[temp addObject:(id)2];
[temp addObject:(id)1];
[temp addObject:(id)2];
[temp addObject:(id)1];
[temp addObject:(id)2];
[temp addObject:(id)1];
[temp addObject:(id)2];
[temp addObject:(id)1];
[temp addObject:(id)0];
[animator setAnimationPattern:temp];
[animator setPatternLoops:1 ];
return self;
}
return nil;
}
-free
{
if (animator)
[animator free];
return [super free];
}
- animate:sender
{
[animator startAnimation:sender];
[button setEnabled:YES];
return self;
}
- stopAnimate:sender
{
[animator stopAnimation];
[button setEnabled:NO];
// [animator displayImageAtIndex:2];
return self;
}
- save:sender
{
NXTypedStream *stream;
//** open file and save data
stream = NXOpenTypedStreamForFile("/Net/java/Users/Developers/t641_craig/anim2.tst", NX_WRITEONLY);
if (!stream)
{
NXRunAlertPanel("File Alert", "Write failed!", NULL, NULL, NULL);
return nil;
}
NXWriteRootObject(stream, animator); //** archive object
NXCloseTypedStream(stream);
return self;
}
- load:sender
{
NXTypedStream *stream;
//** open file and read data
stream = NXOpenTypedStreamForFile("/Net/java/Users/Developers/t641_craig/anim2.tst", NX_READONLY);
if (!stream)
{
NXRunAlertPanel("File Alert", "Read failed!", NULL, NULL, NULL);
return nil;
}
animator = NXReadObject(stream); //** retrieve object
NXCloseTypedStream(stream);
return self;
}
@end